#ifndef CONSTANTES_H_
# define CONSTANTES_H_

# include <stdlib.h>
# include <unistd.h>
# include <stdio.h>

# include "font.h"

enum				e_side
{
  TOP,
  BOTTOM,
  LEFT,
  RIGHT,
  TOP_LEFT,
  TOP_RIGHT,
  BOTTOM_LEFT,
  BOTTOM_RIGHT,
  NONE /* usefull for video zone */
};

/* allow refresh only if we're still using the same drawing window */
enum				e_cmd
{
  REDRAW,
  ADD_PLAYLIST,
  SEEK
};


# define ZONE_MAIN		0
# define ZONE_VIDEO		1
# define ZONE_PLAYLIST   	2
# define ZONE_EXPLORER  	3
# define ZONE_MENUBAR		4
# define ZONE_THUMB		5
# define ZONE_INFOBAR		6


# define CTRL(c)		((c) & 037)

# define DEBUG_MODE		1

/* context predefined windows array */
# define MAX_WIN		7
# define MAX_NB_EXPLORER_FILES  256

/* some aliases */
# define WMAIN			c->win[ZONE_MAIN]
# define WVIDEO			c->win[ZONE_VIDEO]
# define WEXPLORER		c->win[ZONE_EXPLORER]
# define WINFOBAR		c->win[ZONE_INFOBAR]
# define WMENUBAR		c->win[ZONE_MENUBAR]

# define WIN			c->win
# define SWEXPLORER		c->explorer_files
# define EXPLORER_FILENAME	c->explorer_filename
# define SIDE			c->side
# define HEIGHT			c->height
# define WIDTH			c->width
# define NAME			c->name
# define DESCR			c->descr
# define HEIGHT_FONT		c->height_font;
# define WIDTH_FONT		c->width_font;
# define IS_FRAME		c->is_frame

/* Video Window limits */
# define LIM_TOP		c->video_limits[0]
# define LIM_BOTTOM		c->video_limits[1]
# define LIM_LEFT		c->video_limits[2]
# define LIM_RIGHT		c->video_limits[3]

/* function keys -> grepme doesn't allow remapping... */
# define REQ_INFOBAR		'I'
# define REQ_PLAYLIST		'P'
# define REQ_MENUBAR		'M'
# define REQ_EXPLORER		'E'
# define REQ_HELP		KEY_F(1)
# define REQ_HELP2		CTRL('H')
# define REQ_DISP_HOTKEYS	'H'
# define REQ_DISP_HOTKEYS2	KEY_F(2)
# define REQ_PAUSE		' '
# define REQ_PAUSE2		CTRL('P')
# define REQ_FWD		'e'
# define REQ_FFWD		'r'
# define REQ_BWD		'w'
# define REQ_FBWD		'q'
# define REQ_QUIT		CTRL('C')
# define REQ_FULLSCREEN		KEY_F(3)
# define REQ_FULLSCREEN2	CTRL('F')
# define REQ_TERM		CTRL('T')

/* predefined zones size */
# define HEIGHT_MAIN		c->height[ZONE_MAIN]
# define HEIGHT_VIDEO		c->height[ZONE_VIDEO]
# define HEIGHT_INFOBAR		c->height[ZONE_INFOBAR]
# define HEIGHT_MENUBAR		c->height[ZONE_MENUBAR]
# define HEIGHT_THUMB		c->height[ZONE_THUMB]
# define HEIGHT_PLAYLIST	c->height[ZONE_PLAYLIST]
# define HEIGHT_EXPLORER	c->height[ZONE_EXPLORER]

# define WIDTH_MAIN		c->width[ZONE_MAIN]
# define WIDTH_VIDEO		c->width[ZONE_VIDEO]
# define WIDTH_INFOBAR		c->width[ZONE_INFOBAR]
# define WIDTH_MENUBAR		c->width[ZONE_MENUBAR]
# define WIDTH_THUMB		c->width[ZONE_THUMB]
# define WIDTH_PLAYLIST		c->width[ZONE_PLAYLIST]
# define WIDTH_EXPLORER		c->width[ZONE_EXPLORER]


/* predefined zones names */
# define NAME_VIDEO		"VIDEO"
# define NAME_INFOBAR		"INFOBAR"
# define NAME_MENUBAR		"MENUBAR"
# define NAME_PLAYLIST		"PLAYLIST"
# define NAME_THUMB		"THUMB"
# define NAME_EXPLORER		"EXPLORER"

# define DESCR_VIDEO		"Video"
# define DESCR_INFOBAR		"Infos & Subs"
# define DESCR_MENUBAR		"Menubar"
# define DESCR_PLAYLIST		"Playlist"
# define DESCR_THUMB		"Preview"
# define DESCR_EXPLORER		"Explorer"

# define TIME_CHECK_KEYBOARD	300000 /* micro seconds*/

# define FONT_SIZE		c->font_size
# define FONT_SIZE_MEDIUM	8
# define FONT_SIZE_BOLD		12
# define FONT_SIZE_MASSIVE	30

/* nb_char displayable */
# define FONT_THIN		8000
# define FONT_MEDIUM		2000
# define FONT_BOLD		16000

# define EXE_NAME		"AAVP"
# define EXIT_MSG		"press any key to  exit..."
# define EXIT_MSG_LEN		strlen(EXIT_MSG)


/* bigarray index */
# define IBA_SIZE		1024
# define IBA_SCREEN_LINE	1
# define IBA_SCREEN_COL		2
# define IBA_CONTEXT		6
# define IBA_COLORCHAR		7
# define IBA_VID_NBCHAR_WIDTH	8
# define IBA_VID_NBCHAR_HEIGHT  9
# define IBA_VIDEO_LINE		10
# define IBA_VIDEO_COL		11
# define IBA_UPDATE_WVIDEO	12
# define IBA_FRAME_RATE_NUM	13
# define IBA_FRAME_RATE_DEN	14


/* ERROR msg */
# define ERROR_OPEN_FOLDER	"Invalid DIR"

/* explorer's chars*/
# define SYMB_FOLDER		"#"

#endif /* !CONSTANTES_H_ */
